Learning Flex Basics (Part 1): Creating Your First Flex Application
Table of Contents
- Introduction
- A Brief Overview of Macromedia Flex
- Building the Application
- Create the Application Object
- Add a Panel for the Application Layout
- Add a Label for the View Header
- Add an Array of Objects to Define the Coffee Blends
- Add a ComboBox to Display the Coffee Blends
- Add a Text Control to Display the Description
- Add a Button to Add a Coffee Blend to the Shopping Cart
- Add a List Control for the Shopping Cart
- Add a Script to Handle the Button Click Event
- Complete Code Listing for firstapp.mxml
- Where to Go From Here
Create the Application Object
To begin any Flex application, start with an XML declaration and an Application block. The Application tag will include a namespace declaration for the MX
class library: xmlns:mx="http://www.macromedia.com/2003/mxml". The mx prefix is used with all tags for this
library.
- Create a new file and save it as firstapp.mxml in the flex_tutorials directory.
-
At the beginning of the file, insert the XML declaration:
<?xml version="1.0">
-
After the XML declaration, add an
Applicationtag with the MXML namespace:<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml"> </mx:Application>